package tests;

import common.Utils;
import org.openqa.selenium.By;

import java.io.IOException;

public class DetailPage extends Utils {
    public static String url =" http://8.137.19.140:9090/blog_detail.html?blogId=3994";
    public DetailPage() {
        super(url);
    }
    public void ByLogin() throws IOException {
        //测试是否正常打开
        driver.findElement(By.cssSelector("body > div.container > div.right > div > div.operating > button:nth-child(1)"));
        getScreenShot(getClass().getName());
        String title = driver.getTitle();
        assert title.equals("博客详情页");
    }

    //未登录状态
    public void ByNoLogin() throws InterruptedException {
        //因为登录成功后已经在列表页,点击注销
        driver.findElement(By.cssSelector("body > div.nav > a:nth-child(6)")).click();
        //跳转到登录页面
        driver.findElement(By.cssSelector("#submit"));

    }
}
